package com.baihan.angus.app.game.basic.utils;

import android.text.TextUtils;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.widget.TextView;
import android.widget.Toast;

import com.baihan.angus.app.game.basic.BaseApplication;
import com.baihan.angus.app.game.basic.R;


public class Tooast {

    private Tooast() {
    }

    public static void success(String msg) {
        normalInfo(msg);

//        if (msg != null) {  UI要求统一用normal样式
//            Toast toast = new Toast(BaseApplication.getApplication());
//            TextView view = (TextView) LayoutInflater.from(BaseApplication.getApplication()).inflate(R.layout.tooast_view, null);
//            view.setText(msg);
//            view.setBackgroundResource(R.drawable.tooast_view_success_bg);
//            toast.setView(view);
//            toast.setGravity(Gravity.CENTER, 0, 0);
//            toast.show();
//        }
    }

    public static void normalInfo(String msg) {
        if (!TextUtils.isEmpty(msg)) {
            Toast toast = new Toast(BaseApplication.getApplication());
            TextView view = (TextView) LayoutInflater.from(BaseApplication.getApplication()).inflate(R.layout.tooast_view, null);
            view.setText(msg);
            view.setBackgroundResource(R.drawable.tooast_view_normal_bg);
            toast.setView(view);
            toast.setGravity(Gravity.CENTER, 0, 0);
            toast.show();
        }
    }

    public static void warning(String msg) {
        normalInfo(msg);
//        if (msg != null) {
//            Toast toast = new Toast(BaseApplication.getApplication());
//            TextView view = (TextView) LayoutInflater.from(BaseApplication.getApplication()).inflate(R.layout.tooast_view, null);
//            view.setText(msg);
//            view.setBackgroundResource(R.drawable.tooast_view_warning_bg);
//            toast.setView(view);
//            toast.setGravity(Gravity.CENTER, 0, 0);
//            toast.show();
//        }tooast_view_success_bg.xml
//tooast_view_normal_bg.xml
//tooast_view_warning_bg.xml
    }

}
